//
//  VioCityModel.m
//  carcareIOS
//
//  Created by ileo on 16/8/8.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "VioCityModel.h"

@implementation VioCityModel

-(void)fillModelWithDic:(NSDictionary *)dic{
    [super fillModelWithDic:dic];
    
    if ([dic[@"idnum"] isKindOfClass:[NSNumber class]]) {
        self.needIdNum = YES;
    }
    
    NSMutableArray *tmp = [NSMutableArray arrayWithCapacity:self.subcities.count];
    __weak __typeof(self) wself = self;
    if ([self.subcities isKindOfClass:[NSArray class]]) {
        [self.subcities enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            VioCityModel *model = [[VioCityModel alloc] initWithDic:obj];
            model.pid = wself.cid;
            [tmp addObject:model];
        }];
    }
    
    self.subCityModels = [tmp copy];
    
    self.hasSubCities = self.subCityModels.count > 0;
    
    self.canChoice = self.needcap == 0;
    
    [[self.params allKeys] enumerateObjectsUsingBlock:^(NSString *  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([obj isEqualToString:@"idnum"]) {
            wself.idnum = [wself.params[obj] integerValue];
            wself.needIdNum = YES;
            *stop = YES;
        }
    }];
    
}

@end


@implementation VioCityClickModel



@end